// app.js
// 引入并执行utils文件
import './utils/utils'
// 引入并执行http文件
import './utils/http'
// 引入并执行verify文件
import './utils/verify'
App({
  // ---------------全局的属性和方法-begin---------
  token:'',
  getToken(){
    wx.getStorage({
      key:'token',
      success:({data})=>{
        this.token = data
      }
    })
  },
  setToken(token){
    token = `Bearer ${token}`
    this.token = token 
    wx.setStorageSync('token', token)
  },
  refreshToken:'',
  getRefreshToken(){
    wx.getStorage({
      key:'refreshToken',
      success:({data})=>{
        this.refreshToken = data
      }
    })
  },
  setRefreshToken(refreshToken){
    refreshToken = `Bearer ${refreshToken}`
    this.refreshToken = refreshToken 
    wx.setStorageSync('refreshToken', refreshToken)
  },
  onLaunch(){
    this.getToken()
    this.getRefreshToken()
  }
  // ---------------全局的属性和方法-end-----------
})
